import * as api from '@/services/SystemMgr';

const Model = {
  namespace: 'AgentInfo',
  state: {
    agentInfo: [],
  },
  effects: {
    //  根据分期id获取最新的待办信息
    *init({ payload }, { call, put }) {
      yield put({
        type: 'save',
        payload: { agentInfo: [] },
      });
      const response = yield call(api.getSysNoticeByStageIdUsingGET, payload);
      if (response && response.data) {
        const agentInfo = response.data;
        yield put({
          type: 'save',
          payload: { agentInfo },
        });
      }
    },
  },
  reducers: {
    save(state, action) {
      return {
        ...state,
        ...action.payload,
      };
    },
  },
};
export default Model;
